//
//  XMConversationMoreView.m
//  XunMi
//
//  Created by MacBook on 2024/2/26.
//  Copyright © 2024 TieZhu. All rights reserved.
//

#import "XMConversationMoreView.h"

@interface XMConversationMoreView ()
@property (weak, nonatomic) IBOutlet UIView *bgView;

@end

@implementation XMConversationMoreView

- (void)layoutSubviews {
    [super layoutSubviews];
    // 设置左上和右上角为圆角
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bgView.bounds
                                                   byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight)
                                                         cornerRadii:CGSizeMake(20.0, 20.0)];
    CAShapeLayer *maskLayer = [CAShapeLayer layer];
    maskLayer.frame = self.bgView.bounds;
    maskLayer.path = maskPath.CGPath;
    self.bgView.layer.mask = maskLayer;
    
    self.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapBg)];
    [self addGestureRecognizer:tap];
}

- (void)tapBg {
    if (self.clickBlock) {
        self.clickBlock(XMConversationMoreClose);
    }
}

- (IBAction)btnAct:(UIButton *)sender {
    if (self.clickBlock) {
        self.clickBlock(sender.tag);
    }
}

@end
